<!--订单详情-->
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    :maskClosable="false"
    :keyboard="false"
    :forceRender="true"
    :style="modalStyle"
    @cancel="handleCancel"
  >
    <template slot="footer">
      <a-button v-if="billPrintFlag" @click="handlePrint">{{ $t('button.sanlianPrintPreview') }}</a-button>
      <!--此处为解决缓存问题-->
      <a-button v-if="billType === '零售出库'" v-print="'#retailOutPrint'">{{ $t('button.normalPrint') }}</a-button>
      <a-button v-if="billType === '零售退货入库'" v-print="'#retailBackPrint'">{{ $t('button.normalPrint') }}
      </a-button>
      <a-button v-if="billType === '请购单'" v-print="'#purchaseApplyPrint'">{{ $t('button.normalPrint') }}</a-button>
      <a-button v-if="billType === '采购订单'" v-print="'#purchaseOrderPrint'">{{ $t('button.normalPrint') }}</a-button>
      <a-button v-if="billType === '采购入库'" v-print="'#purchaseInPrint'">{{ $t('button.normalPrint') }}</a-button>
      <a-button v-if="billType === '采购退货出库'" v-print="'#purchaseBackPrint'">{{ $t('button.normalPrint') }}
      </a-button>
      <a-button v-if="billType === '销售订单'" v-print="'#saleOrderPrint'">{{ $t('button.normalPrint') }}</a-button>
      <a-button v-if="billType === '销售审核'" v-print="'#saleOrderPrint'">{{ $t('button.normalPrint') }}</a-button>
      <a-button v-if="billType === '仓库出库'" @click="toPdf">{{ $t('button.downloadCheque') }}</a-button>
      <a-button v-if="billType === '仓库出库'" type="primary" @click="printInvoice">{{ $t('button.printCheque') }}
      </a-button>
      <!--      <a-button v-if="billType === '销售退货入库'" v-print="'#saleBackPrint'">{{ $t('button.normalPrint') }}</a-button>-->
      <a-button v-if="billType === '销售退货入库'" @click="toSaleReturnPdf">{{
          $t('button.downloadSaleReturn')
        }}
      </a-button>
      <a-button v-if="billType === '销售退货入库'" type="primary" @click="printSaleReturn">
        {{ $t('button.printSaleReturn') }}
      </a-button>
      <a-button v-if="billType === '其它入库'" v-print="'#otherInPrint'">{{ $t('button.normalPrint') }}</a-button>
      <a-button v-if="billType === '其它出库'" v-print="'#otherOutPrint'">{{ $t('button.normalPrint') }}</a-button>
      <a-button v-if="billType === '调拨出库'" v-print="'#allocationOutPrint'"> {{ $t('button.normalPrint') }}
      </a-button>
      <a-button v-if="billType === '组装单'" v-print="'#assemblePrint'">{{ $t('button.normalPrint') }}</a-button>
      <a-button v-if="billType === '拆卸单'" v-print="'#disassemblePrint'">{{ $t('button.normalPrint') }}</a-button>
      <a-button v-if="billType === '盘点复盘'" v-print="'#stockCheckReplayPrint'">{{ $t('button.normalPrint') }}
      </a-button>
      <!--导出Excel-->
      <a-button v-if="billType === '零售出库'||billType === '零售退货入库'" @click="retailExportExcel()">
        {{ $t('button.export') }}
      </a-button>
      <a-button v-if="billType === '请购单'" @click="applyExportExcel()">{{ $t('button.export') }}</a-button>
      <a-button v-if="billType === '采购订单'||billType === '销售订单'" @click="orderExportExcel()">
        {{ $t('button.export') }}
      </a-button>
      <a-button
        v-if="billType === '采购入库'||billType === '采购退货出库'||billType === '仓库出库'||billType === '销售退货入库'"
        @click="purchaseSaleExportExcel()">{{ $t('button.export') }}
      </a-button>
      <a-button v-if="billType === '其它入库'||billType === '其它出库'" @click="otherExportExcel()">
        {{ $t('button.export') }}
      </a-button>
      <a-button v-if="billType === '调拨出库'" @click="allocationOutExportExcel()">{{ $t('button.export') }}</a-button>
      <a-button v-if="billType === '组装单'||billType === '拆卸单'" @click="assembleExportExcel()">
        {{ $t('button.export') }}
      </a-button>
      <a-button v-if="billType === '盘点复盘'" @click="stockCheckReplayExportExcel()">{{ $t('button.export') }}
      </a-button>

      <a-button v-if="billType === '销售审核'" type="primary" @click="approveSaleOrder()">{{ $t('button.approve') }}
      </a-button>
      <a-button v-if="billType === '销售审核'" @click="handleBackCheck()">{{ $t('button.backApprove') }}</a-button>
      <a-button v-else-if="checkFlag && isCanBackCheck && model.status==='1'" @click="handleBackCheck()">
        {{ $t('button.backApprove') }}
      </a-button>
      <a-button key="back" @click="handleCancel">{{ $t('button.cancel') }}</a-button>
    </template>
    <a-form :form="form" layout="vertical">
      <!--零售出库-->
      <template v-if="billType === '零售出库'">
        <section ref="print" id="retailOutPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.memberCard')">
                <a-input v-decorator="['id']" hidden/>
                {{ model.organName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.payType')">
                {{ model.payType }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="18" :md="12" :sm="24">
              <div :style="tableWidthRetail">
                <a-table
                  ref="table"
                  size="middle"
                  bordered
                  rowKey="id"
                  :scroll="{y: 300}"
                  :pagination="false"
                  :loading="loading"
                  :columns="columns"
                  :dataSource="dataSource">
                  <template slot="customBarCode" slot-scope="text, record">
                    <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                    <a-popover placement="right" trigger="click">
                      <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                      </template>
                      <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                        :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                        class="item-img"
                                                                        title="$t('button.viewBigImg')" /></div>
                    </a-popover>
                  </template>
                </a-table>
              </div>
            </a-col>
            <a-col :span="6">
              <a-row class="form-row" :gutter="24">
                <a-col :lg="24" :md="6" :sm="6">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.changeAmount')">
                    {{ model.changeAmount }}
                  </a-form-item>
                </a-col>
                <a-col :lg="24" :md="6" :sm="6">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.getAmount')">
                    {{ model.getAmount }}
                  </a-form-item>
                </a-col>
                <a-col :lg="24" :md="6" :sm="6">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.backAmount')">
                    {{ model.backAmount }}
                  </a-form-item>
                </a-col>
                <a-col :lg="24" :md="6" :sm="6">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.accountName')">
                    {{ model.accountName }}
                  </a-form-item>
                </a-col>
                <a-col v-if="model.hasBackFlag" :lg="24" :md="6" :sm="6">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.backNumber')">
                    <template v-for="(item, index) in linkNumberList">
                      <a @click="myHandleDetail(item.number)">{{ item.number }}</a><br/>
                    </template>
                  </a-form-item>
                </a-col>
              </a-row>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--零售退货-->
      <template v-else-if="billType === '零售退货入库'">
        <section ref="print" id="retailBackPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.memberCard')">
                <a-input v-decorator="['id']" hidden/>
                {{ model.organName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.linkBill')">
                <a @click="myHandleDetail(model.linkNumber)">{{ model.linkNumber }}</a>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="18" :md="12" :sm="24">
              <div :style="tableWidthRetail">
                <a-table
                  ref="table"
                  size="middle"
                  bordered
                  rowKey="id"
                  :scroll="{y: 300}"
                  :pagination="false"
                  :loading="loading"
                  :columns="columns"
                  :dataSource="dataSource">
                  <template slot="customBarCode" slot-scope="text, record">
                    <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                    <a-popover placement="right" trigger="click">
                      <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                      </template>
                      <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                        :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                        class="item-img"
                                                                        title="$t('button.viewBigImg')" /></div>
                    </a-popover>
                  </template>
                </a-table>
              </div>
            </a-col>
            <a-col :span="6">
              <a-row class="form-row" :gutter="24">
                <a-col :lg="24" :md="6" :sm="6">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.changeAmount')">
                    {{ model.changeAmount }}
                  </a-form-item>
                </a-col>
                <a-col :lg="24" :md="6" :sm="6">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.getAmount')">
                    {{ model.getAmount }}
                  </a-form-item>
                </a-col>
                <a-col :lg="24" :md="6" :sm="6">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.backAmount')">
                    {{ model.backAmount }}
                  </a-form-item>
                </a-col>
                <a-col :lg="24" :md="6" :sm="6">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.accountName')">
                    {{ model.accountName }}
                  </a-form-item>
                </a-col>
              </a-row>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--请购单-->
      <template v-else-if="billType === '请购单'">
        <section ref="print" id="purchaseApplyPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
            </a-col>
            <a-col :span="6">
            </a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--采购订单-->
      <template v-else-if="billType === '采购订单'">
        <section ref="print" id="purchaseOrderPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.supplier')">
                <a-input v-decorator="['id']" hidden/>
                {{ model.organName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6" v-if="model.linkApply">
              <a-form-item :labelCol="{xs: { span: 24 },sm: { span: 6 }}" :wrapperCol="wrapperCol"
                           :label="$t('search.linkPurchaseRequisitionBill')">
                <a @click="myHandleDetail(model.linkApply)">{{ model.linkApply }}</a>
              </a-form-item>
            </a-col>
            <a-col :span="6" v-if="model.linkNumber">
              <a-form-item v-if="purchaseBySaleFlag" :labelCol="labelCol" :wrapperCol="wrapperCol"
                           :label="$t('search.linkBill')">
                {{ model.linkNumber }}
              </a-form-item>
            </a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.discount')">
                {{ model.discount }}%
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.discountMoney')">
                {{ model.discountMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="{xs: { span: 24 },sm: { span: 6 }}" :wrapperCol="wrapperCol"
                           :label="$t('search.discountLastMoney')">
                {{ model.discountLastMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6"></a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.accountName1')">
                {{ model.accountName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.deposit')">
                {{ model.changeAmount }}
              </a-form-item>
            </a-col>
            <a-col :span="6"></a-col>
            <a-col :span="6"></a-col>
          </a-row>
        </section>
      </template>
      <!--采购入库-->
      <template v-else-if="billType === '采购入库'">
        <section ref="print" id="purchaseInPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.supplier')">
                <a-input v-decorator="['id']" hidden/>
                {{ model.organName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.linkBill')">
                <a @click="myHandleDetail(model.linkNumber)">{{ model.linkNumber }}</a>
              </a-form-item>
            </a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.discount')">
                {{ model.discount }}%
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.discountMoney')">
                {{ model.discountMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="{xs: { span: 24 },sm: { span: 6 }}" :wrapperCol="wrapperCol"
                           :label="$t('search.discountLastMoney')">
                {{ model.discountLastMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.otherMoney')">
                {{ model.otherMoney }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.accountName1')">
                {{ model.accountName }}
              </a-form-item>
            </a-col>
            <a-col v-if="model.deposit" :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.deposit')">
                {{ model.deposit }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.changeAmount')">
                {{ model.changeAmount }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.debt')">
                {{ model.debt }}
              </a-form-item>
            </a-col>
            <a-col v-if="model.hasBackFlag" :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.backNumber')">
                <template v-for="(item, index) in linkNumberList">
                  <a @click="myHandleDetail(item.number)">{{ item.number }}</a><br/>
                </template>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col v-if="financialBillNoList.length" :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.payBillNumber')">
                <template v-for="(item, index) in financialBillNoList">
                  <a @click="myHandleFinancialDetail(item.billNo)">{{ item.billNo }}</a><br/>
                </template>
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--采购退货-->
      <template v-else-if="billType === '采购退货出库'">
        <section ref="print" id="purchaseBackPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.supplier')">
                <a-input v-decorator="['id']" hidden/>
                {{ model.organName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.linkBill')">
                <a @click="myHandleDetail(model.linkNumber)">{{ model.linkNumber }}</a>
              </a-form-item>
            </a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.discount')">
                {{ model.discount }}%
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.backDiscountMoney')">
                {{ model.discountMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="{xs: { span: 24 },sm: { span: 6 }}" :wrapperCol="wrapperCol"
                           :label="$t('search.discountLastMoney')">
                {{ model.discountLastMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.otherMoney')">
                {{ model.otherMoney }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.accountName1')">
                {{ model.accountName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.backChangeAmount')">
                {{ model.changeAmount }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.debt')">
                {{ model.debt }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
            </a-col>
          </a-row>
        </section>
      </template>
      <!--销售订单-->
      <template v-else-if="billType === '销售订单' || billType === '销售审核'">
        <section ref="print" id="saleOrderPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.customer')">
                <a-input v-decorator="['id']" hidden/>
                {{ model.organName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.salesMan')">
                {{ model.salesManStr }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.pono')">
                {{ model.pono }}
              </a-form-item>
            </a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{x:1200,y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.saleTaxMoney')">
                {{ model.taxMoney }}%
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.discount')">
                {{ model.discount }}%
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.discountMoney')">
                {{ model.discountMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="{xs: { span: 24 },sm: { span: 6 }}" :wrapperCol="wrapperCol"
                           :label="$t('search.discountLastMoney')">
                {{ model.discountLastMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6"></a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.taxValue')">
                {{ model.taxValue }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.accountName1')">
                {{ model.accountName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.deposit')">
                {{ model.changeAmount }}
              </a-form-item>
            </a-col>
            <a-col :span="6"></a-col>
            <a-col :span="6"></a-col>
          </a-row>
        </section>
      </template>
      <!--仓库出库-->
      <template v-else-if="billType === '仓库出库'">
        <section ref="print" id="saleOutPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.customer')">
                <a-input v-decorator="['id']" hidden/>
                {{ model.organName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.linkBill')">
                <a @click="myHandleDetail(model.linkNumber)">{{ model.linkNumber }}</a>
              </a-form-item>
            </a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.saleTaxMoney')">
                {{ model.taxMoney }}%
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.discount')">
                {{ model.discount }}%
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.discountMoney')">
                {{ model.discountMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="{xs: { span: 24 },sm: { span: 6 }}" :wrapperCol="wrapperCol"
                           :label="$t('search.discountLastMoney')">
                {{ model.discountLastMoney }}
              </a-form-item>
            </a-col>

          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.otherMoney')">
                {{ model.otherMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.accountName1')">
                {{ model.accountName }}
              </a-form-item>
            </a-col>
            <a-col v-if="model.deposit" :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.deductionDeposit')">
                {{ model.deposit }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.changeAmount2')">
                {{ model.changeAmount }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.debt')">
                {{ model.debt }}
              </a-form-item>
            </a-col>
            <a-col v-if="model.hasBackFlag" :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.backNumber')">
                <template v-for="(item, index) in linkNumberList">
                  <a @click="myHandleDetail(item.number)">{{ item.number }}</a><br/>
                </template>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.salesMan')">
                {{ model.salesManStr }}
              </a-form-item>
            </a-col>
            <a-col v-if="financialBillNoList.length" :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.receiptBillNumber')">
                <template v-for="(item, index) in financialBillNoList">
                  <a @click="myHandleFinancialDetail(item.billNo)">{{ item.billNo }}</a><br/>
                </template>
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--销售退货-->
      <template v-else-if="billType === '销售退货入库'">
        <section ref="print" id="saleBackPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.customer')">
                <a-input v-decorator="['id']" hidden/>
                {{ model.organName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.saleBackBillNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.saleBacklinkBill')">
                {{ model.linkNumber }}
                <!--                <a @click="myHandleDetail(model.linkNumber)">{{ model.linkNumber }}</a>-->
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.saleBackDueDate')">
                {{ model.saleBackDueDate }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.issueDate1')">
                {{ model.issueDate ? model.issueDate.split('T')[0] : '' }}
              </a-form-item>
            </a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{ y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.saleTaxMoney')">
                {{ model.taxMoney }}%
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.discount')">
                {{ model.discount }}%
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.backDiscountMoney')">
                {{ model.discountMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="{xs: { span: 24 },sm: { span: 6 }}" :wrapperCol="wrapperCol"
                           :label="$t('search.discountLastMoney')">
                {{ model.discountLastMoney }}
              </a-form-item>
            </a-col>

          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.otherMoney')">
                {{ model.otherMoney }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.accountName1')">
                {{ model.accountName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.backChangeAmount')">
                {{ model.changeAmount }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.debt')">
                {{ model.debt }}
              </a-form-item>
            </a-col>
          </a-row>
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.salesMan')">
                {{ model.salesManStr }}
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--其它入库-->
      <template v-else-if="billType === '其它入库'">
        <section ref="print" id="otherInPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.supplier')">
                <a-input v-decorator="['id']" hidden/>
                {{ model.organName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item v-if="model.billType" :labelCol="labelCol" :wrapperCol="wrapperCol"
                           :label="$t('search.linkBill')">
                {{ model.linkNumber }} {{ model.billType }}
              </a-form-item>
              <a-form-item v-if="!model.billType" :labelCol="labelCol" :wrapperCol="wrapperCol"
                           :label="$t('search.linkBill')">
                <a @click="myHandleDetail(model.linkNumber)">{{ model.linkNumber }}</a>
              </a-form-item>
            </a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--其它出库-->
      <template v-else-if="billType === '其它出库'">
        <section ref="print" id="otherOutPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.customer')">
                <a-input v-decorator="['id']" hidden/>
                {{ model.organName }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item v-if="model.billType" :labelCol="labelCol" :wrapperCol="wrapperCol"
                           :label="$t('search.linkBill')">
                {{ model.linkNumber }} {{ model.billType }}
              </a-form-item>
              <a-form-item v-if="!model.billType" :labelCol="labelCol" :wrapperCol="wrapperCol"
                           :label="$t('search.linkBill')">
                <a @click="myHandleDetail(model.linkNumber)">{{ model.linkNumber }}</a>
              </a-form-item>
            </a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--调拨出库-->
      <template v-else-if="billType === '调拨出库'">
        <section ref="print" id="allocationOutPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6"></a-col>
            <a-col :span="6"></a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--组装单-->
      <template v-else-if="billType === '组装单'">
        <section ref="print" id="assemblePrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6"></a-col>
            <a-col :span="6"></a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--拆卸单-->
      <template v-else-if="billType === '拆卸单'">
        <section ref="print" id="disassemblePrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6"></a-col>
            <a-col :span="6"></a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <!--盘点复盘-->
      <template v-else-if="billType === '盘点复盘'">
        <section ref="print" id="stockCheckReplayPrint">
          <a-row class="form-row" :gutter="24">
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billCreateTimeRange')">
                {{ model.operTimeStr }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.billNumber')">
                {{ model.number }}
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('search.linkBill')">
                {{ model.linkNumber }}
              </a-form-item>
            </a-col>
            <a-col :span="6"></a-col>
          </a-row>
          <div :style="tableWidth">
            <a-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :scroll="{y: 300}"
              :pagination="false"
              :loading="loading"
              :columns="columns"
              :dataSource="dataSource">
              <template slot="customBarCode" slot-scope="text, record">
                <div :style="record.imgName?'float:left;line-height:30px':'float:left;'">{{ record.barCode }}</div>
                <a-popover placement="right" trigger="click">
                  <template slot="content"><img :src="getImgUrl(record.imgName, record.imgLarge)" width="500px"/>
                  </template>
                  <div class="item-info" v-if="record.imgName"><img v-if="record.imgName"
                                                                    :src="getImgUrl(record.imgName, record.imgSmall)"
                                                                    class="item-img" title="$t('button.viewBigImg')" />
                  </div>
                </a-popover>
              </template>
            </a-table>
          </div>
          <a-row class="form-row" :gutter="24">
            <a-col :lg="24" :md="24" :sm="24">
              <a-form-item :labelCol="labelCol" :wrapperCol="{xs: { span: 24 },sm: { span: 24 }}" label=""
                           style="padding:20px 10px;">
                {{ model.remark }}
              </a-form-item>
            </a-col>
          </a-row>
        </section>
      </template>
      <template v-if="fileList && fileList.length>0">
        <a-row class="form-row" :gutter="24">
          <a-col :span="10">
            <a-form-item :labelCol="{xs: { span: 24 },sm: { span: 3 }}"
                         :wrapperCol="{xs: { span: 24 },sm: { span: 21 }}" :label="$t('search.billAttachment')">
              <j-upload v-model="fileList" bizPath="bill" :disabled="true" :buttonVisible="false"></j-upload>
            </a-form-item>
          </a-col>
          <a-col :span="14"></a-col>
        </a-row>
      </template>
    </a-form>
    <bill-print-iframe ref="modalDetail"></bill-print-iframe>
    <financial-detail ref="financialDetailModal"></financial-detail>
  </j-modal>
</template>

<script>
import pick from 'lodash.pick'
import {getAction, getFileAccessHttpUrl, postAction} from '@/api/manage'
import {
  findBillDetailByNumber,
  findFinancialDetailByNumber,
  getCurrentSystemConfig,
  getPlatformConfigByKey,
  saleOutPrintData,
  saleReturnPrintData
} from '@/api/api'
import {exportXlsPost, getCheckFlag, getMpListShort} from '@/utils/util'
import BillPrintIframe from './BillPrintIframe'
import FinancialDetail from '../../financial/dialog/FinancialDetail'
import JUpload from '@/components/jeecg/JUpload'
import Vue from 'vue'
import printTemplate from '@/print/printTemplate'
import saleReturnTemplate from '@/print/returnPrintTemplate'
import {hiprint} from 'vue-plugin-hiprint'

export default {
  name: 'BillDetail',
  components: {
    BillPrintIframe,
    FinancialDetail,
    JUpload
  },
  data() {
    return {
      title: '详情',
      width: '1600px',
      visible: false,
      modalStyle: '',
      model: {},
      isCanBackCheck: true,
      billType: '',
      billPrintFlag: false,
      fileList: [],
      purchaseBySaleFlag: false,
      linkNumberList: [],
      financialBillNoList: [],
      /* 原始反审核是否开启 */
      checkFlag: true,

      tableWidth: {
        'width': '1500px'
      },
      tableWidthRetail: {
        'width': '1150px'
      },
      labelCol: {
        xs: {span: 24},
        sm: { span: 6 }
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 16}
      },
      form: this.$form.createForm(this),
      loading: false,
      dataSource: [],
      url: {
        detailList: '/depotItem/getDetailList',
        batchSetStatusUrl: '/depotHead/batchSetStatus'
      },
      //表头
      columns: [],
      //列定义
      defColumns: [],
      retailOutColumns: [
        { title: this.$t('search.depotName'), dataIndex: 'depotName' },
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.snList'), dataIndex: 'snList', width: 300 },
        { title: this.$t('search.batchNumber'), dataIndex: 'batchNumber' },
        { title: this.$t('search.expirationDate'), dataIndex: 'expirationDate' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.weight'), dataIndex: 'weight' },
        { title: this.$t('search.position'), dataIndex: 'position' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      retailBackColumns: [
        { title: this.$t('search.depotName'), dataIndex: 'depotName' },
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.snList'), dataIndex: 'snList', width: 300 },
        { title: this.$t('search.batchNumber'), dataIndex: 'batchNumber' },
        { title: this.$t('search.expirationDate'), dataIndex: 'expirationDate' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.weight'), dataIndex: 'weight' },
        { title: this.$t('search.position'), dataIndex: 'position' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      purchaseApplyColumns: [
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.finishNumber'), dataIndex: 'finishNumber' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      purchaseOrderColumns: [
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.finishNumber1'), dataIndex: 'finishNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.taxRate'), dataIndex: 'taxRate' },
        { title: this.$t('search.taxMoney'), dataIndex: 'taxMoney' },
        { title: this.$t('search.taxLastMoney'), dataIndex: 'taxLastMoney' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      purchaseInColumns: [
        { title: this.$t('search.depotName'), dataIndex: 'depotName' },
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.snList'), dataIndex: 'snList', width: 300 },
        { title: this.$t('search.batchNumber'), dataIndex: 'batchNumber' },
        { title: this.$t('search.expirationDate'), dataIndex: 'expirationDate' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.finishNumber1'), dataIndex: 'finishNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.taxRate'), dataIndex: 'taxRate' },
        { title: this.$t('search.taxMoney'), dataIndex: 'taxMoney' },
        { title: this.$t('search.taxLastMoney'), dataIndex: 'taxLastMoney' },
        { title: this.$t('search.weight'), dataIndex: 'weight' },
        { title: this.$t('search.position'), dataIndex: 'position' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      purchaseBackColumns: [
        { title: this.$t('search.depotName'), dataIndex: 'depotName' },
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.snList'), dataIndex: 'snList', width: 300 },
        { title: this.$t('search.batchNumber'), dataIndex: 'batchNumber' },
        { title: this.$t('search.expirationDate'), dataIndex: 'expirationDate' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.finishNumber2'), dataIndex: 'finishNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.taxRate'), dataIndex: 'taxRate' },
        { title: this.$t('search.taxMoney'), dataIndex: 'taxMoney' },
        { title: this.$t('search.taxLastMoney'), dataIndex: 'taxLastMoney' },
        { title: this.$t('search.weight'), dataIndex: 'weight' },
        { title: this.$t('search.position'), dataIndex: 'position' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      saleOrderColumns: [
        {title: this.$t('search.barCode'), dataIndex: 'barCode', width: 140},
        {title: this.$t('search.name'), dataIndex: 'name', width: 140},
        {title: this.$t('search.standard'), dataIndex: 'standard', width: 80},
        {title: this.$t('search.model'), dataIndex: 'model', width: 70},
        {title: this.$t('search.color'), dataIndex: 'color', width: 70},
        {title: this.$t('search.materialOther'), dataIndex: 'materialOther', width: 80},
        {title: this.$t('search.stock'), dataIndex: 'stock', width: 80},
        {title: this.$t('search.unit'), dataIndex: 'unit', width: 80},
        {title: this.$t('search.sku'), dataIndex: 'sku', width: 80},
        {title: this.$t('search.operNumber'), dataIndex: 'operNumber', width: 80},
        {title: this.$t('search.finishNumber2'), dataIndex: 'finishNumber', width: 80},
        {title: this.$t('search.unitPrice'), dataIndex: 'unitPrice', width: 80},
        {title: this.$t('search.allPrice'), dataIndex: 'allPrice', width: 100},
        // { title: this.$t('search.taxRate'), dataIndex: 'taxRate' },
        // { title: this.$t('search.taxMoney'), dataIndex: 'taxMoney' },
        // { title: this.$t('search.taxLastMoney'), dataIndex: 'taxLastMoney' },
        {title: this.$t('search.discount'), dataIndex: 'discount', width: 90},
        {title: this.$t('search.discountMoney2'), dataIndex: 'discountMoney', width: 90},
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      //仓库出库
      saleOutColumns: [
        {title: this.$t('search.depotName'), dataIndex: 'depotName', width: 120},
        {title: this.$t('search.barCode'), dataIndex: 'barCode', width: 140},
        {title: this.$t('search.name'), dataIndex: 'name', width: 140},
        {title: this.$t('search.standard'), dataIndex: 'standard', width: 70},
        {title: this.$t('search.model'), dataIndex: 'model', width: 70},
        {title: this.$t('search.color'), dataIndex: 'color', width: 70},
        {title: this.$t('search.materialOther'), dataIndex: 'materialOther', width: 75},
        {title: this.$t('search.stock'), dataIndex: 'stock', width: 80},
        {title: this.$t('search.unit'), dataIndex: 'unit', width: 80},
        {title: this.$t('search.snList'), dataIndex: 'snList', width: 120},
        {title: this.$t('search.batchNumber'), dataIndex: 'batchNumber', width: 80},
        {title: this.$t('search.expirationDate'), dataIndex: 'expirationDate', width: 120},
        {title: this.$t('search.sku'), dataIndex: 'sku', width: 80},
        {title: this.$t('search.operNumber'), dataIndex: 'operNumber', width: 80},
        {title: this.$t('search.finishNumber2'), dataIndex: 'finishNumber', width: 80},
        {title: this.$t('search.unitPrice'), dataIndex: 'unitPrice', width: 80},
        {title: this.$t('search.allPrice'), dataIndex: 'allPrice', width: 80},
        // { title: this.$t('search.taxRate'), dataIndex: 'taxRate' },
        // { title: this.$t('search.taxMoney'), dataIndex: 'taxMoney' },
        // { title: this.$t('search.taxLastMoney'), dataIndex: 'taxLastMoney' },
        {title: this.$t('search.discount'), dataIndex: 'discount', width: 80},
        {title: this.$t('search.discountMoney2'), dataIndex: 'discountMoney', width: 85},
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      saleBackColumns: [
        {title: this.$t('search.depotName'), dataIndex: 'depotName', width: 60},
        {title: this.$t('search.barCode'), dataIndex: 'barCode', width: 100},
        {title: this.$t('search.name'), dataIndex: 'name', width: 120},
        {title: this.$t('search.standard'), dataIndex: 'standard', width: 60},
        {title: this.$t('search.model'), dataIndex: 'model', width: 90},
        {title: this.$t('search.color'), dataIndex: 'color', width: 70},
        {title: this.$t('search.materialOther'), dataIndex: 'materialOther', width: 80},
        {title: this.$t('search.stock'), dataIndex: 'stock', width: 80},
        {title: this.$t('search.unit'), dataIndex: 'unit', width: 60},
        {title: this.$t('search.snList'), dataIndex: 'snList', width: 80},
        {title: this.$t('search.batchNumber'), dataIndex: 'batchNumber', width: 70},
        {title: this.$t('search.expirationDate'), dataIndex: 'expirationDate', width: 70},
        {title: this.$t('search.sku'), dataIndex: 'sku', width: 70},
        {title: this.$t('search.operNumber'), dataIndex: 'operNumber', width: 70},
        {title: this.$t('search.finishNumber1'), dataIndex: 'finishNumber', width: 70},
        {title: this.$t('search.unitPrice'), dataIndex: 'unitPrice', width: 70},
        {title: this.$t('search.allPrice'), dataIndex: 'allPrice', width: 90},
        // { title: this.$t('search.taxRate'), dataIndex: 'taxRate' },
        // { title: this.$t('search.taxMoney'), dataIndex: 'taxMoney' },
        // { title: this.$t('search.taxLastMoney'), dataIndex: 'taxLastMoney' },
        {title: this.$t('search.weight'), dataIndex: 'weight', width: 60},
        {title: this.$t('search.discount'), dataIndex: 'discount', width: 60},
        {title: this.$t('search.discountMoney2'), dataIndex: 'discountMoney', width: 70},
        {title: this.$t('search.position'), dataIndex: 'position', width: 80},
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      otherInColumns: [
        { title: this.$t('search.depotName'), dataIndex: 'depotName' },
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.snList'), dataIndex: 'snList', width: 300 },
        { title: this.$t('search.batchNumber'), dataIndex: 'batchNumber' },
        { title: this.$t('search.expirationDate'), dataIndex: 'expirationDate' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.weight'), dataIndex: 'weight' },
        { title: this.$t('search.position'), dataIndex: 'position' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      otherOutColumns: [
        { title: this.$t('search.depotName'), dataIndex: 'depotName' },
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.snList'), dataIndex: 'snList', width: 300 },
        { title: this.$t('search.batchNumber'), dataIndex: 'batchNumber' },
        { title: this.$t('search.expirationDate'), dataIndex: 'expirationDate' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.weight'), dataIndex: 'weight' },
        { title: this.$t('search.position'), dataIndex: 'position' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      allocationOutColumns: [
        { title: this.$t('search.depotName'), dataIndex: 'depotName' },
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.anotherDepotName'), dataIndex: 'anotherDepotName' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.weight'), dataIndex: 'weight' },
        { title: this.$t('search.position'), dataIndex: 'position' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      assembleColumns: [
        { title: this.$t('search.mType'), dataIndex: 'mType' },
        { title: this.$t('search.depotName'), dataIndex: 'depotName' },
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      disassembleColumns: [
        { title: this.$t('search.mType'), dataIndex: 'mType' },
        { title: this.$t('search.depotName'), dataIndex: 'depotName' },
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.color'), dataIndex: 'color' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ],
      stockCheckReplayColumns: [
        { title: this.$t('search.depotName'), dataIndex: 'depotName' },
        { title: this.$t('search.barCode'), dataIndex: 'barCode' },
        { title: this.$t('search.name'), dataIndex: 'name' },
        { title: this.$t('search.standard'), dataIndex: 'standard' },
        { title: this.$t('search.model'), dataIndex: 'model' },
        { title: this.$t('search.materialOther'), dataIndex: 'materialOther' },
        { title: this.$t('search.stock'), dataIndex: 'stock' },
        { title: this.$t('search.unit'), dataIndex: 'unit' },
        { title: this.$t('search.sku'), dataIndex: 'sku' },
        { title: this.$t('search.operNumber'), dataIndex: 'operNumber' },
        { title: this.$t('search.unitPrice'), dataIndex: 'unitPrice' },
        { title: this.$t('search.allPrice'), dataIndex: 'allPrice' },
        { title: this.$t('search.remark'), dataIndex: 'remark' }
      ]
    }
  },
  created() {
    let realScreenWidth = window.screen.width
    this.width = realScreenWidth < 1500 ? '1200px' : '1550px'
    this.tableWidth = {
      'width': realScreenWidth < 1500 ? '1150px' : '1500px'
    }
    this.tableWidthRetail = {
      'width': realScreenWidth < 1500 ? '800px' : '1100px'
    }
  },
  mounted () {
    this.buildDesigner()
  },

  methods: {
    buildDesigner () {
      // 确保 hiprint 库已经加载
      if (typeof hiprint !== 'undefined') {
        $('#hiprint-printTemplate').empty() // 先清空, 避免重复构建
        this.hiprintTemplate = new hiprint.PrintTemplate({
          template: printTemplate,
          settingContainer: '#PrintElementOptionSetting' // 元素参数容器
        })

        this.saleReturnTemplate = new hiprint.PrintTemplate({
          template: saleReturnTemplate,
          settingContainer: '#PrintElementOptionSetting' // 元素参数容器
        })
      }
    },
    initSetting(record, type, ds) {
      if (type === '零售出库') {
        this.defColumns = this.retailOutColumns
      } else if (type === '零售退货入库') {
        this.defColumns = this.retailBackColumns
      } else if (type === '请购单') {
        this.defColumns = this.purchaseApplyColumns
      } else if (type === '采购订单') {
        this.defColumns = this.purchaseOrderColumns
      } else if (type === '采购入库') {
        this.defColumns = this.purchaseInColumns
      } else if (type === '采购退货出库') {
        this.defColumns = this.purchaseBackColumns
      } else if (type === '销售订单') {
        this.defColumns = this.saleOrderColumns
      } else if (type === '销售审核') {
        this.defColumns = this.saleOrderColumns
      } else if (type === '仓库出库') {
        this.defColumns = this.saleOutColumns
      } else if (type === '销售退货入库') {
        this.defColumns = this.saleBackColumns
      } else if (type === '其它入库') {
        this.defColumns = this.otherInColumns
      } else if (type === '其它出库') {
        this.defColumns = this.otherOutColumns
      } else if (type === '调拨出库') {
        this.defColumns = this.allocationOutColumns
      } else if (type === '组装单') {
        this.defColumns = this.assembleColumns
      } else if (type === '拆卸单') {
        this.defColumns = this.disassembleColumns
      } else if (type === '盘点复盘') {
        this.defColumns = this.stockCheckReplayColumns
      }
      //判断序列号、批号、有效期、多属性、重量、仓位货架是否有值
      let needAddkeywords = []
      for (let i = 0; i < ds.length; i++) {
        if (ds[i].snList) {
          needAddkeywords.push('snList')
        }
        if (ds[i].batchNumber) {
          needAddkeywords.push('batchNumber')
        }
        if (ds[i].expirationDate) {
          needAddkeywords.push('expirationDate')
        }
        if (ds[i].sku) {
          needAddkeywords.push('sku')
        }
        if (ds[i].weight) {
          needAddkeywords.push('weight')
        }
        if (ds[i].position) {
          needAddkeywords.push('position')
        }
      }
      let currentCol = [{
        title: '#', dataIndex: '', align: 'center', width: 55, customRender: function (t, r, index) {
          return parseInt(index) + 1
        }
      }]
      if (record.status === '3') {
        //部分采购|部分销售的时候显示全部列
        for (let i = 0; i < this.defColumns.length; i++) {
          currentCol.push(this.defColumns[i])
        }
        this.columns = currentCol
      } else if (record.purchaseStatus === '3') {
        //将已出库的标题转为已采购，针对销售订单转采购订单的场景
        for (let i = 0; i < this.defColumns.length; i++) {
          let info = {}
          info.title = this.defColumns[i].title
          info.dataIndex = this.defColumns[i].dataIndex
          if (this.defColumns[i].width) {
            info.width = this.defColumns[i].width
          }
          if (this.defColumns[i].dataIndex === 'finishNumber') {
            info.title = this.$t('title.purchased')
          }
          if (this.defColumns[i].dataIndex === 'barCode') {
            info.scopedSlots = {customRender: 'customBarCode'}
          }
          currentCol.push(info)
        }
        this.columns = currentCol
      } else {
        for (let i = 0; i < this.defColumns.length; i++) {
          //移除列
          let needRemoveKeywords = ['finishNumber', 'snList', 'batchNumber', 'expirationDate', 'sku', 'weight', 'position']
          if (needRemoveKeywords.indexOf(this.defColumns[i].dataIndex) === -1) {
            let info = {}
            info.title = this.defColumns[i].title
            info.dataIndex = this.defColumns[i].dataIndex
            if (this.defColumns[i].width) {
              info.width = this.defColumns[i].width
            }
            if (this.defColumns[i].dataIndex === 'barCode') {
              info.scopedSlots = {customRender: 'customBarCode'}
            }
            currentCol.push(info)
          }
          //添加有数据的列
          if (needAddkeywords.indexOf(this.defColumns[i].dataIndex) > -1) {
            let info = {}
            info.title = this.defColumns[i].title
            info.dataIndex = this.defColumns[i].dataIndex
            if (this.defColumns[i].width) {
              info.width = this.defColumns[i].width
            }
            currentCol.push(info)
          }
        }
        this.columns = currentCol
      }
    },
    initPlatform() {
      getPlatformConfigByKey({'platformKey': 'bill_print_flag'}).then((res) => {
        if (res && res.code === 200) {
          if (this.billType === '零售出库' || this.billType === '零售退货入库' || this.billType === '请购单' ||
            this.billType === '采购订单' || this.billType === '采购入库' || this.billType === '采购退货出库' ||
            this.billType === '销售订单' || this.billType === '仓库出库' || this.billType === '销售退货入库' ||
            this.billType === '其它入库' || this.billType === '其它出库' || this.billType === '调拨出库' ||
            this.billType === '组装单' || this.billType === '拆卸单') {
            this.billPrintFlag = res.data.platformValue === '1' ? true : false
          }
        }
      })
    },
    getSystemConfig() {
      getCurrentSystemConfig().then((res) => {
        if (res.code === 200 && res.data) {
          this.purchaseBySaleFlag = res.data.purchaseBySaleFlag === '1' ? true : false
          let multiBillType = res.data.multiBillType
          let multiLevelApprovalFlag = res.data.multiLevelApprovalFlag
          this.checkFlag = getCheckFlag(multiBillType, multiLevelApprovalFlag, this.prefixNo)
        }
      })
    },
    getBillListByLinkNumber(number) {
      getAction('/depotHead/getBillListByLinkNumber', {number: number}).then(res => {
        if (res && res.code === 200) {
          this.linkNumberList = res.data
        }
      })
    },
    getFinancialBillNoByBillId(billId) {
      getAction('/accountHead/getFinancialBillNoByBillId', {billId: billId}).then(res => {
        if (res && res.code === 200) {
          this.financialBillNoList = res.data
        }
      })
    },
    show(record, type, prefixNo) {
      //[销售订单： record "销售订单"  XSDD ] [仓库出库 DB]
      //查询单条单据信息，入口
      findBillDetailByNumber({number: record.number}).then((res) => {
        if (res && res.code === 200) {
          let item = res.data
          this.billType = type
          this.prefixNo = prefixNo
          //附件下载
          this.fileList = item.fileName
          this.visible = true
          this.modalStyle = 'top:20px;height: 95%;'
          this.model = Object.assign({}, item)
          if (this.model.backAmount) {
            this.model.getAmount = (this.model.changeAmount + this.model.backAmount).toFixed(2)
          } else {
            this.model.getAmount = this.model.changeAmount
          }
          this.model.debt = (this.model.discountLastMoney + this.model.otherMoney - (this.model.deposit + this.model.changeAmount)).toFixed(2)
          this.$nextTick(() => {
            this.form.setFieldsValue(pick(this.model, 'id'))
          })
          let showType = 'basic'
          if (item.subType === '采购' || item.subType === '采购退货' || item.subType === '销售' || item.subType === '销售退货') {
            if (item.status === '3') {
              showType = 'other'
            }
          } else {
            if (item.status === '3') {
              showType = 'basic'
            } else if (item.purchaseStatus === '3') {
              showType = 'purchase'
            }
          }
          let isReadOnly = '1'
          if (item.subType === '组装单' || item.subType === '拆卸单') {
            isReadOnly = '0'
          }
          let params = {
            headerId: this.model.id,
            mpList: getMpListShort(Vue.ls.get('materialPropertyList')),  //扩展属性
            linkType: showType,
            isReadOnly: isReadOnly
          }
          let url = this.readOnly ? this.url.detailList : this.url.detailList
          this.requestSubTableData(item, type, url, params)
          this.initPlatform()
          this.getSystemConfig()
          this.getBillListByLinkNumber(this.model.number)
          this.getFinancialBillNoByBillId(this.model.id)
        }
      })
    },
    requestSubTableData(record, type, url, params, success) {
      this.loading = true
      getAction(url, params).then(res => {
        if (res && res.code === 200) {
          this.dataSource = res.data.rows
          this.initSetting(record, type, this.dataSource)
          typeof success === 'function' ? success(res) : ''
        }
      }).finally(() => {
        this.loading = false
      })
    },
    handleBackCheck() {
      let that = this
      this.$confirm({
        title: this.$t('title.backCheck'),
        content: this.$t('notice.backCheck'),
        onOk: function () {
          that.loading = true
          postAction(that.url.batchSetStatusUrl, {
            status: '0',
            ids: that.model.id,
            subType: this.billType
          }).then((res) => {
            if (res.code === 200) {
              that.$emit('ok')
              that.loading = false
              that.close()
            } else {
              that.$message.warning(res.data.message)
              that.loading = false
            }
          }).finally(() => {
          })
        }
      })
    },
    approveSaleOrder() {

      this.loading = true
      postAction(this.url.batchSetStatusUrl, {
        status: '10',
        ids: this.model.id,
        subType: this.billType
      }).then((res) => {
        if (res.code === 200) {
          this.$emit('ok')
          this.loading = false
          this.close()
        } else {
          this.$message.warning(res.data.message)
          this.loading = false
        }
      }).finally(() => {
      })
    },
    handleCancel() {
      this.close()
    },
    close() {
      this.$emit('close')
      this.visible = false
      this.modalStyle = ''
    },
    myHandleDetail(billNumber) {
      findBillDetailByNumber({number: billNumber}).then((res) => {
        if (res && res.code === 200) {
          let type = res.data.type === '其它' ? '' : res.data.type
          this.show(res.data, res.data.subType + type)
          this.title = res.data.subType + type + '-详情'
        }
      })
    },
    myHandleFinancialDetail(billNo) {
      let that = this
      findFinancialDetailByNumber({billNo: billNo}).then((res) => {
        if (res && res.code === 200) {
          if (that.$refs.financialDetailModal) {
            that.$refs.financialDetailModal.show(res.data, res.data.type)
            that.$refs.financialDetailModal.title = res.data.type + '-详情'
          }
        }
      })
    },
    getImgUrl(imgName, type) {
      if (imgName && imgName.split(',')) {
        type = type ? type + '/' : ''
        return getFileAccessHttpUrl('systemConfig/static/' + type + imgName.split(',')[0])
      } else {
        return ''
      }
    },
    //三联打印预览
    handlePrint() {
      getPlatformConfigByKey({'platformKey': 'bill_print_url'}).then((res) => {
        if (res && res.code === 200) {
          let billPrintUrl = res.data.platformValue + '?no=' + this.model.number
          let billPrintHeight = this.dataSource.length * 50 + 600
          this.$refs.modalDetail.show(this.model, billPrintUrl, billPrintHeight)
          this.$refs.modalDetail.title = this.billType + '-' + this.$t('title.threeLinkPrintPreview')
        }
      })
    },
    //零售出库|零售退货入库
    retailExportExcel() {
      let list = []
      let head = '仓库名称,条码,名称,规格,型号,颜色,扩展信息,库存,单位,序列号,批号,有效期,多属性,数量,单价,金额,备注'
      for (let i = 0; i < this.dataSource.length; i++) {
        let item = []
        let ds = this.dataSource[i]
        item.push(ds.depotName, ds.barCode, ds.name, ds.standard, ds.model, ds.color, ds.materialOther, ds.stock, ds.unit,
          ds.snList, ds.batchNumber, ds.expirationDate, ds.sku, ds.operNumber, ds.unitPrice, ds.allPrice, ds.remark)
        list.push(item)
      }
      let organName = this.model.organName ? '会员卡号' + this.model.organName : ''
      let tip = organName + ' ' + '单据日期：' + this.model.operTimeStr + ' ' + '单据编号：' + this.model.number
      exportXlsPost(this.billType + '_' + this.model.number, '单据导出', head, tip, list)
    },
    //请购单
    applyExportExcel() {
      let list = []
      let head = '条码,名称,规格,型号,颜色,扩展信息,单位,多属性,原数量,已采购,数量,备注'
      for (let i = 0; i < this.dataSource.length; i++) {
        let item = []
        let ds = this.dataSource[i]
        item.push(ds.barCode, ds.name, ds.standard, ds.model, ds.color, ds.materialOther, ds.unit, ds.sku,
          ds.preNumber, ds.finishNumber, ds.operNumber, ds.remark)
        list.push(item)
      }
      let tip = '单据日期：' + this.model.operTimeStr + ' ' + '单据编号：' + this.model.number
      exportXlsPost(this.billType + '_' + this.model.number, '单据导出', head, tip, list)
    },
    //采购订单|销售订单
    orderExportExcel() {
      let list = []
      let finishType = ''
      let organType = ''
      if (this.billType === '采购订单') {
        finishType = '已入库'
        organType = '供应商：'
      } else if (this.billType === '销售订单') {
        finishType = '已出库'
        organType = '客户：'
      }
      let head = '条码,名称,规格,型号,颜色,扩展信息,库存,单位,多属性,数量,' + finishType + ',单价,金额,税率(%),税额,价税合计,备注'
      for (let i = 0; i < this.dataSource.length; i++) {
        let item = []
        let ds = this.dataSource[i]
        item.push(ds.barCode, ds.name, ds.standard, ds.model, ds.color, ds.materialOther, ds.stock, ds.unit, ds.sku,
          ds.operNumber, ds.finishNumber, ds.unitPrice, ds.allPrice, ds.taxRate, ds.taxMoney, ds.taxLastMoney, ds.remark)
        list.push(item)
      }
      let organName = this.model.organName ? this.model.organName : ''
      let tip = organType + organName + ' ' + '单据日期：' + this.model.operTimeStr + ' ' + '单据编号：' + this.model.number
      exportXlsPost(this.billType + '_' + this.model.number, '单据导出', head, tip, list)
    },
    //采购入库|采购退货出库|仓库出库|销售退货入库
    purchaseSaleExportExcel() {
      let list = []
      let organType = ''
      if (this.billType === '采购入库' || this.billType === '采购退货出库') {
        organType = '供应商：'
      } else if (this.billType === '仓库出库' || this.billType === '销售退货入库') {
        organType = '客户：'
      }
      let head = '仓库名称,条码,名称,规格,型号,颜色,扩展信息,库存,单位,序列号,批号,有效期,多属性,数量,单价,金额,税率(%),税额,价税合计,重量,备注'
      for (let i = 0; i < this.dataSource.length; i++) {
        let item = []
        let ds = this.dataSource[i]
        item.push(ds.depotName, ds.barCode, ds.name, ds.standard, ds.model, ds.color, ds.materialOther, ds.stock, ds.unit,
          ds.snList, ds.batchNumber, ds.expirationDate, ds.sku, ds.operNumber, ds.unitPrice, ds.allPrice, ds.taxRate, ds.taxMoney, ds.taxLastMoney, ds.weight, ds.remark)
        list.push(item)
      }
      let organName = this.model.organName ? this.model.organName : ''
      let linkNumber = this.model.linkNumber ? this.model.linkNumber : ''
      let tip = organType + organName + ' ' + '单据日期：' + this.model.operTimeStr + ' ' + '单据编号：' +
        this.model.number + '' + '关联单号：' + linkNumber
      exportXlsPost(this.billType + '_' + this.model.number, '单据导出', head, tip, list)
    },
    //其它入库|其它出库
    otherExportExcel() {
      let list = []
      let organType = ''
      if (this.billType === '其它入库') {
        organType = '供应商：'
      } else if (this.billType === '其它出库') {
        organType = '客户：'
      }
      let head = '仓库名称,条码,名称,规格,型号,颜色,扩展信息,库存,单位,序列号,批号,有效期,多属性,数量,单价,金额,备注'
      for (let i = 0; i < this.dataSource.length; i++) {
        let item = []
        let ds = this.dataSource[i]
        item.push(ds.depotName, ds.barCode, ds.name, ds.standard, ds.model, ds.color, ds.materialOther, ds.stock, ds.unit,
          ds.snList, ds.batchNumber, ds.expirationDate, ds.sku, ds.operNumber, ds.unitPrice, ds.allPrice, ds.remark)
        list.push(item)
      }
      let organName = this.model.organName ? this.model.organName : ''
      let tip = organType + organName + ' ' + '单据日期：' + this.model.operTimeStr + ' ' + '单据编号：' + this.model.number
      exportXlsPost(this.billType + '_' + this.model.number, '单据导出', head, tip, list)
    },
    //调拨出库
    allocationOutExportExcel() {
      let list = []
      let head = '仓库名称,条码,名称,规格,型号,颜色,扩展信息,库存,调入仓库,单位,多属性,数量,单价,金额,备注'
      for (let i = 0; i < this.dataSource.length; i++) {
        let item = []
        let ds = this.dataSource[i]
        item.push(ds.depotName, ds.barCode, ds.name, ds.standard, ds.model, ds.color, ds.materialOther, ds.stock, ds.anotherDepotName, ds.unit,
          ds.sku, ds.operNumber, ds.unitPrice, ds.allPrice, ds.remark)
        list.push(item)
      }
      let tip = '单据日期：' + this.model.operTimeStr + ' ' + '单据编号：' + this.model.number
      exportXlsPost(this.billType + '_' + this.model.number, '单据导出', head, tip, list)
    },
    printInvoice () {
      if (!this.hiprintTemplate) {
        console.error('HiPrint template is not initialized')
        return
      }
      let printParam = {
        id: this.model.id
      }
      let data = null
      this.confirmLoading = true // 开始加载
      saleOutPrintData(printParam).then((res) => {
        if (res && res.code === 200) {
          data = res.data
          //this.hiprintTemplate.toPdf(data)
          this.hiprintTemplate.print(data, {
            styleHandler: () => {
              return `
                  table, th, td {
                  border: 1px solid black;
                  border-collapse: collapse;
                }
              `
            }
          })
        } else {
          this.$message.error('get print data failed')
        }
      }).catch((error) => {
        console.error('获取打印数据出错:', error)
        this.$message.error('获取打印数据出错')
      }).finally(() => {
        this.confirmLoading = false // 结束加载
      })

      //this.$refs.printInvoice.show();

    },
    toPdf() {
      if (!this.hiprintTemplate) {
        console.error('HiPrint template is not initialized')
        return
      }
      let printParam = {
        id: this.model.id
      }
      let data = null
      this.confirmLoading = true // 开始加载
      saleOutPrintData(printParam).then((res) => {
        if (res && res.code === 200) {
          data = res.data
          this.hiprintTemplate.toPdf(data, '123')
          // this.hiprintTemplate.print(data, {
          //   styleHandler: () => {
          //     return `
          //         table, th, td {
          //         border: 1px solid black;
          //         border-collapse: collapse;
          //       }
          //     `
          //   }
          // })
        } else {
          this.$message.error('get print data failed')
        }
      }).catch((error) => {
        console.error('获取打印数据出错:', error)
        this.$message.error('获取打印数据出错')
      }).finally(() => {
        this.confirmLoading = false // 结束加载
      })
    },
    printSaleReturn() {
      if (!this.saleReturnTemplate) {
        console.error('HiPrint saleReturnTemplate is not initialized')
        return
      }
      let printParam = {
        id: this.model.id
      }
      let data = null
      this.confirmLoading = true // 开始加载
      saleReturnPrintData(printParam).then((res) => {
        if (res && res.code === 200) {
          data = res.data
          //this.hiprintTemplate.toPdf(data)
          this.saleReturnTemplate.print(data, {
            styleHandler: () => {
              return `
                  table, th, td {
                  border: 1px solid black;
                  border-collapse: collapse;
                }
              `
            }
          })
        } else {
          this.$message.error('get print data failed')
        }
      }).catch((error) => {
        console.error('获取打印数据出错:', error)
        this.$message.error('获取打印数据出错')
      }).finally(() => {
        this.confirmLoading = false // 结束加载
      })

      //this.$refs.printInvoice.show();

    },
    toSaleReturnPdf() {
      if (!this.saleReturnTemplate) {
        console.error('HiPrint saleReturnTemplate is not initialized')
        return
      }
      let printParam = {
        id: this.model.id
      }
      let data = null
      this.confirmLoading = true // 开始加载
      saleReturnPrintData(printParam).then((res) => {
        if (res && res.code === 200) {
          data = res.data
          this.saleReturnTemplate.toPdf(data, '123')
          // this.hiprintTemplate.print(data, {
          //   styleHandler: () => {
          //     return `
          //         table, th, td {
          //         border: 1px solid black;
          //         border-collapse: collapse;
          //       }
          //     `
          //   }
          // })
        } else {
          this.$message.error('get print data failed')
        }
      }).catch((error) => {
        console.error('获取打印数据出错:', error)
        this.$message.error('获取打印数据出错')
      }).finally(() => {
        this.confirmLoading = false // 结束加载
      })
    },
    //组装单|拆卸单
    assembleExportExcel() {
      let list = []
      let head = ['商品类型,仓库名称,条码,名称,规格,型号,颜色,扩展信息,库存,单位,多属性,数量,单价,金额,备注']
      for (let i = 0; i < this.dataSource.length; i++) {
        let item = []
        let ds = this.dataSource[i]
        item.push(ds.mType, ds.depotName, ds.barCode, ds.name, ds.standard, ds.model, ds.color, ds.materialOther, ds.stock, ds.unit,
          ds.sku, ds.operNumber, ds.unitPrice, ds.allPrice, ds.remark)
        list.push(item)
      }
      let tip = '单据日期：' + this.model.operTimeStr + ' ' + '单据编号：' + this.model.number
      exportXlsPost(this.billType + '_' + this.model.number, '单据导出', head, tip, list)
    },
    //盘点复盘
    stockCheckReplayExportExcel() {
      let list = []
      let head = '仓库名称,条码,名称,规格,型号,扩展信息,库存,单位,多属性,数量,单价,金额,备注'
      for (let i = 0; i < this.dataSource.length; i++) {
        let item = []
        let ds = this.dataSource[i]
        item.push(ds.depotName, ds.barCode, ds.name, ds.standard, ds.model, ds.materialOther, ds.stock, ds.unit,
          ds.sku, ds.operNumber, ds.unitPrice, ds.allPrice, ds.remark)
        list.push(item)
      }
      let linkNumber = this.model.linkNumber ? this.model.linkNumber : ''
      let tip = '单据日期：' + this.model.operTimeStr + ' ' + '单据编号：' + this.model.number + '' + '关联单号：' + linkNumber
      exportXlsPost(this.billType + '_' + this.model.number, '单据导出', head, tip, list)
    }
  }
}
</script>

<style scoped>
.item-info {
  float: left;
  width: 30px;
  height: 30px;
  margin-left: 8px
}

.ant-table-hide-scrollbar {
  scrollbar-color: unset !important;
}

.item-img {
  cursor: pointer;
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 添加表格列对齐样式 */
.align-table >>> .ant-table-thead > tr > th,
.align-table >>> .ant-table-tbody > tr > td {
  padding: 12px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.align-table >>> .ant-table-fixedLeft,
.align-table >>> .ant-table-fixedRight {
  z-index: auto;
}
</style>